<?php
/**
 * Created by JetBrains PhpStorm.
 * User: ST2
 * Date: 08.11.12
 * Time: 14:44
 * To change this template use File | Settings | File Templates.
 */

if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED!==true)die();

$arResult = array();

$listLite = 17; // ifnoblock-id with lite-tarif;
$listPrem = 22;
$GLOBAL['shop_filter'] = true;

//$accId = ""; // infoblock-id with acc
global $USER;
if($USER->IsAuthorized()){
    $currentUser = $USER->GetId();

    $premiumUserList = array();
    $liteUserList = array();

    if(CModule::IncludeModule("iblock")){
        //check for premium acc
        $arOrder = array(
            "sort" => "asc"
        );
        $arFilter = array(
            'ACTIVE' => "Y",
            'IBLOCK_ID' => $listPrem,
            'NAME' => $currentUser
        );
        $arSelect = array(
            'ID',
            'IBLOCK_ID',
            'NAME',
            'PROPERTY_bids'
        );

        $rsPremium = CIBlockElement::GetList($arOrder, $arFilter, false, false, $arSelect);
        $premiumUserList = array();
        while($obPremium = $rsPremium->GetNextElement())
        {
            $arPremium = $obPremium->GetFields();
            $premiumUserList[] =  $arPremium;
        }
		echo '<pre>';
		//echo 'hello2';
		//var_dump($premiumUserList);
		echo '</pre>';
		//die();

        if(count($premiumUserList) != 0){
            foreach($premiumUserList as $value){
				if($value['PROPERTY_BIDS_VALUE'] > 0){
					$GLOBAL['shop_filter'] = false;
				}
			}
        } else {
            
        }




    }
} else {
    $arResult['err'] = "Auth";
}


$this->IncludeComponentTemplate();